﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using DoubanApiLib.Base;
using System.Data;
namespace DoubanApiLib.Access.Account
{
    /// <summary>
    /// 关于用户信息的API封装
    /// </summary>
    public class AccountAccess : AccessBase
    {
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static DataSet GetUserInfo(string userId)
        {
            string apiUrl = Runtime.Api.Account.GetUserInfo.FormatMe(userId);
            return GetApiDataSet(apiUrl);
        }
        /// <summary>
        /// 搜索用户
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="startIndex"></param>
        /// <param name="maxResult"></param>
        /// <returns></returns>
        public static DataSet SelectUsersInfo(string keyword,int startIndex,int maxResult)
        {
            string apiUrl = Runtime.Api.Account.SelectUsersInfo.FormatMe(keyword, startIndex, maxResult);
            return GetApiDataSet(apiUrl);
        }
        public static DataSet GetCurrentOauthUserInfo(string accessToken, string accessTokenSecret)
        {
            string apiUrl = Runtime.Api.Account.GetOAuthUserInfo;
            return GetApiDataSet(apiUrl, accessToken, accessTokenSecret);
        }

        public static DataSet GetUserFriends(string userId,int startIndex,int maxResult,string accessToken, string accessTokenSecret)
        {
            string apiUrl = Runtime.Api.Account.GetUserFriends.FormatMe(userId,startIndex, maxResult);
            return GetApiDataSet(apiUrl,accessToken,accessTokenSecret);
        }

        public static DataSet Test(string apiUrl)
        {
            return GetApiDataSet(apiUrl);
        }
    }
}
